/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;
import com.sun.lwuit.Command;
import com.sun.lwuit.Form;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.layouts.BorderLayout;

/**
 *
 * @author Kvest
 */
public class UnregisterConfirmation  extends Form  implements ActionListener
{
    public static final int EMPTY_ID = 0;
    public static final int OK_ID = 1;
    public static final int CANCEL_ID = 2;

    private Command ok;
    private Command cancel;
    private FormAction listener;

    public UnregisterConfirmation(FormAction listener)
    {
        super("Запрос");
        this.listener = listener;

        init();
    }

    private void init()
    {
        setLayout(new BorderLayout());

        addCommandListener(this);

        addCommand(new Command("", EMPTY_ID));
        cancel= new Command("Отмена", CANCEL_ID);
        addCommand(cancel);

        ok = new Command("Ok", OK_ID);
        addCommand(ok);

        TextArea text = new TextArea("Вы действительно хотите сняться со стоянки?", 1, 30);
        text.setAlignment(TextArea.LEFT);
        text.setEditable(false);

        addComponent(BorderLayout.NORTH, text);
    }

    public void actionPerformed(ActionEvent evt)
    {
        if (listener != null)
        {
            listener.commandAction(evt.getCommand().getId());
        }
    }
}
